package questiondata;
import java.io.Serializable;

public class Question implements Serializable {
	private String title;
	private int id;
	private int ans_num;
	private String ans_data[];
	private int weight;
	private int right_ans;
	public Question(String way) {
		if (way == "test") {
			title = "test_question: which of the following is not a programing language?";
			id = 1;
			ans_num = 4;
			ans_data = new String[4];
			ans_data[0] = "c";
			ans_data[1] = "c++";
			ans_data[2] = "java";
			ans_data[3] = "chinese";
			weight = 1;
			right_ans = 3;
		}
	}
	
	public String getTitle() {
		return title;
	}
	
	public void setTitle(String _title) {
		title = _title;
	}
	
	public int getId() {
		return id;
	}
	
	public void setId(int _id) {
		id = _id;
	}
	
	public void setAns_data(String[] _ans_data) {
		int size = _ans_data.length;
		ans_num = size;
		for (int i = 0; i < size; i++) {
			ans_data[i] = _ans_data[i];
		}
	}
	
	public String[] getAns_data() {
		return ans_data;
	}
	
	public void setAns_num(int _ans_num) {
		ans_num = _ans_num;
	}
	
	public int getAns_num() {
		return ans_num;
	}
	
	public void setRight_ans(int right) {
		if (right < 0 || right >ans_num) {
			right = 0;
		}
		right_ans = right;
	}
	
	public int getRigth_ans() {
		return right_ans;
	}
	
	public void setWeight(int _weight) {
		weight = _weight;
	}

	public int getWeigth() {
		return weight;
	}
	
	public String to_String() {
		String result;
		result = title+'\n';
		for (int i = 0; i < ans_num; i++) {
			result = result  + ans_data[i] + '\n';
		}
		return result;
	}
	public String to_save_String() {
		String result;
		result = title+'\t'+weight+'\t'+right_ans+'\t'+ans_num;
		for (int i = 0; i < ans_num; i++) {
			result = result + '\t' + ans_data[i];
		}
		result += '\n';
		return result;
	}
}
